
        <?php
        
        include 'Person.php';
        include 'ClientManager.php';
        include 'Validator.php';
        include 'PersonValidator.php';
        include 'LanguageSkills.php';
        
        $myPerson = new Person();        // person object to hold client information
        $myClienMananger = new ClientManager($myPerson);
        $LanguageList=$myClienMananger->LanguageIDArray();
        $LanguageLevelList=$myClienMananger->LanguageLevelIDArray();
        //$myClienMananger->InsertPerson();
        
        //$myClienMananger->InsertPerson(new person());
        //$message=$myClienMananger->InsertLanguageKnowledge(59,2,3);
        //$message=$myClienMananger->InsertPersonLang(13);
        
        if(@$_POST['ClearButton'])  
        {
        unset($_POST);
        }
        
        if(@$_POST['Button'])  // if SUBMIT button is clicked...
        {
        $personValidator = new PersonValidator($myPerson,$LanguageList,$LanguageLevelList); // this smells apparently, however at least hides the details :)
        $personValidator->DoValidation(); // validate data and initialize person object 
        //$personValidator->PopulatePerson();
        
        
        
        if($myPerson->IsValid)  // person is valid. We can SUBMIT.
        {
            
            $message=$myClienMananger->InsertPerson();  // some exception handling still needed
            if(!$message)
            {
            $message="Person inserted succesfully";
            unset($_POST);
            }
            
            
        }
        
        else // person is invalid, set the errormessages.
        {            
            $ErrorList=$personValidator->errorList;
            $message="u cant  submit till the following fields are missing or invalid";            
        }
        }

     

        include("Attila.php");
        
        
        ?>
         
        
        <?php
        ?>  
        